n=input()
s=int(input())
l=int(n[0])
for i in range(1,len(n)):
    if s==0:
        break
    if int(n[i])<l:
        l=int(n[i])
        n=n[:i-1]+"#"+n[i:]
        s-=1
    else:
        l=int(n[i])
i=0
while i<len(n):
    try:
        if n[i]=="#":
            n=n[:i]+n[i+1:]
            i-=1
        i+=1
    except:
        break
n2=[int(x) for x in n]
for i in range(0,s):
    n=n[:n.index(str(max(n2)))]+n[n.index(str(max(n2)))+1:]
print(n)